package com.huaxin.feignclient.device.models;

import com.huaxin.feignclient.device.models.enums.DeviceType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 设备数据采集记录 - 新增请求DTO
 */
@Data
public class DeviceDataCollectionWideAddDTO {

    /**
     * 设备类型
     * 示例值：0.4KV电力监测仪表
     * 可选值：10KV电力监测仪表, 0.4KV电力监测仪表, 配电房环境监测, 微机保护,
     * 有源信号监测模块, 无源信号监测模块, 变压器温控仪, 无线测温主机
     */
    @Schema(description = "设备类型", example = "0.4KV电力监测仪表", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "设备类型不能为空")
    private String deviceType;

    /**
     * 设备id
     * 示例值：PDU-001
     */
    @Schema(description = "设备名称或编号", example = "PDU-001")
    private Long deviceId;

    /**
     * A相电压 (kV)
     * 示例值：0.380
     */
    @Schema(description = "A相电压 (kV)", example = "0.380")
    private BigDecimal voltageAKv;

    /**
     * B相电压 (kV)
     * 示例值：0.378
     */
    @Schema(description = "B相电压 (kV)", example = "0.378")
    private BigDecimal voltageBKv;

    /**
     * C相电压 (kV)
     * 示例值：0.382
     */
    @Schema(description = "C相电压 (kV)", example = "0.382")
    private BigDecimal voltageCKv;

    /**
     * AB线电压 (kV)
     * 示例值：0.660
     */
    @Schema(description = "AB线电压 (kV)", example = "0.660")
    private BigDecimal voltageAbKv;

    /**
     * BC线电压 (kV)
     * 示例值：0.658
     */
    @Schema(description = "BC线电压 (kV)", example = "0.658")
    private BigDecimal voltageBcKv;

    /**
     * CA线电压 (kV)
     * 示例值：0.662
     */
    @Schema(description = "CA线电压 (kV)", example = "0.662")
    private BigDecimal voltageCaKv;

    /**
     * A相电流 (A)
     * 示例值：120.500
     */
    @Schema(description = "A相电流 (A)", example = "120.500")
    private BigDecimal currentAA;

    /**
     * B相电流 (A)
     * 示例值：118.200
     */
    @Schema(description = "B相电流 (A)", example = "118.200")
    private BigDecimal currentBA;

    /**
     * C相电流 (A)
     * 示例值：122.800
     */
    @Schema(description = "C相电流 (A)", example = "122.800")
    private BigDecimal currentCA;

    /**
     * 总功率因数
     * 示例值：0.960
     */
    @Schema(description = "总功率因数", example = "0.960")
    private BigDecimal powerFactorTotal;

    /**
     * 总有功功率 (kW)
     * 示例值：75.300
     */
    @Schema(description = "总有功功率 (kW)", example = "75.300")
    private BigDecimal activePowerTotalKw;

    /**
     * 总无功功率 (kvar)
     * 示例值：23.100
     */
    @Schema(description = "总无功功率 (kvar)", example = "23.100")
    private BigDecimal reactivePowerTotalKvar;

    /**
     * 总视在功率 (kVA)
     * 示例值：80.000
     */
    @Schema(description = "总视在功率 (kVA)", example = "80.000")
    private BigDecimal apparentPowerTotalKva;

    /**
     * 正向有功电度 (kWh)
     * 示例值：15678.300
     */
    @Schema(description = "正向有功电度 (kWh)", example = "15678.300")
    private BigDecimal energyActiveForwardKwh;

    /**
     * 正向无功电度 (kWh)
     * 示例值：3421.500
     */
    @Schema(description = "正向无功电度 (kWh)", example = "3421.500")
    private BigDecimal energyReactiveForwardKwh;

    /**
     * 反向有功电度 (kWh)
     * 示例值：120.000
     */
    @Schema(description = "反向有功电度 (kWh)", example = "120.000")
    private BigDecimal energyActiveReverseKwh;

    /**
     * 反向无功电度 (kWh)
     * 示例值：85.600
     */
    @Schema(description = "反向无功电度 (kWh)", example = "85.600")
    private BigDecimal energyReactiveReverseKwh;

    /**
     * 频率 (Hz)
     * 示例值：50.00
     */
    @Schema(description = "频率 (Hz)", example = "50.00")
    private BigDecimal frequencyHz;

    /**
     * 烟雾告警: 0-正常, 1-告警
     * 示例值：0
     */
    @Schema(description = "烟雾告警: 0-正常, 1-告警", example = "0")
    private Integer alarmSmoke;

    /**
     * 人员入侵告警: 0-正常, 1-告警
     * 示例值：0
     */
    @Schema(description = "人员入侵告警: 0-正常, 1-告警", example = "0")
    private Integer alarmIntrusion;

    /**
     * 水浸告警: 0-正常, 1-告警
     * 示例值：0
     */
    @Schema(description = "水浸告警: 0-正常, 1-告警", example = "0")
    private Integer alarmWater;

    /**
     * 环境温度 (℃)
     * 示例值：25.50
     */
    @Schema(description = "环境温度 (℃)", example = "25.50")
    private BigDecimal temperatureRoom;

    /**
     * 环境湿度 (%RH)
     * 示例值：60.25
     */
    @Schema(description = "环境湿度 (%RH)", example = "60.25")
    private BigDecimal humidityRoomRh;

    /**
     * 视频快照链接或Base64字符串
     * 示例值：https://oss.xxx.com/snapshots/20250405_102345.jpg 或 data:image/jpg;base64,...
     */
    @Schema(description = "视频快照链接或Base64字符串", example = "https://oss.xxx.com/snapshots/20250405_102345.jpg")
    private String videoSnapshotUrl;

    /**
     * 断路器1状态: open=分闸, closed=合闸
     * 示例值：closed
     */
    @Schema(description = "断路器1状态: open=分闸, closed=合闸", example = "closed")
    private String breaker1Status;

    /**
     * 断路器2状态: open=分闸, closed=合闸
     * 示例值：open
     */
    @Schema(description = "断路器2状态: open=分闸, closed=合闸", example = "open")
    private String breaker2Status;

    /**
     * 断路器3状态: open=分闸, closed=合闸
     * 示例值：closed
     */
    @Schema(description = "断路器3状态: open=分闸, closed=合闸", example = "closed")
    private String breaker3Status;

    /**
     * 变压器A相温度 (℃)
     * 示例值：78.25
     */
    @Schema(description = "变压器A相温度 (℃)", example = "78.25")
    private BigDecimal transformerTempA;

    /**
     * 变压器B相温度 (℃)
     * 示例值：76.80
     */
    @Schema(description = "变压器B相温度 (℃)", example = "76.80")
    private BigDecimal transformerTempB;

    /**
     * 变压器C相温度 (℃)
     * 示例值：79.10
     */
    @Schema(description = "变压器C相温度 (℃)", example = "79.10")
    private BigDecimal transformerTempC;

    /**
     * 电缆A相温度 (℃)
     * 示例值：65.40
     */
    @Schema(description = "电缆A相温度 (℃)", example = "65.40")
    private BigDecimal cableTempA;

    /**
     * 电缆B相温度 (℃)
     * 示例值：63.90
     */
    @Schema(description = "电缆B相温度 (℃)", example = "63.90")
    private BigDecimal cableTempB;

    /**
     * 电缆C相温度 (℃)
     * 示例值：66.20
     */
    @Schema(description = "电缆C相温度 (℃)", example = "66.20")
    private BigDecimal cableTempC;

    /**
     * 站号
     * 示例值：ST001
     */
    @Schema(description = "站号", example = "ST001", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "站号不能为空")
    private Long stationNumber;
    // 指标码
    @Schema(description = "指标码", example = "10004")
    private String indexCode;
    // 注意：orgId、familyId、创建人等字段建议由后端从登录上下文自动填充，不从前端接收
}